home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
bbsutil
/
bsrc_250.zip
/
YOOHOO.C
< prev
next >
Wrap
C/C++ Source or Header
|
1991-09-15
|
19KB
|
596 lines
/*--------------------------------------------------------------------------*/
/* */
/* */
/* ------------ Bit-Bucket Software, Co. */
/* \ 10001101 / Writers and Distributors of */
/* \ 011110 / Freely Available<tm> Software. */
/* \ 1011 / */
/* ------ */
/* */
/* (C) Copyright 1987-91, Bit Bucket Software Co., a Delaware Corporation. */
/* */
/* */
/* This module was written by Vince Perriello */
/* */
/* */
/* BinkleyTerm "YooHoo" Processor */
/* */
/* */
/* For complete details of the licensing restrictions, please refer */
/* to the License agreement, which is published in its entirety in */
/* the MAKEFILE and BT.C, and also contained in the file LICENSE.250. */
/* */
/* USE OF THIS FILE IS SUBJECT TO THE RESTRICTIONS CONTAINED IN THE */
/* BINKLEYTERM LICENSING AGREEMENT. IF YOU DO NOT FIND THE TEXT OF */
/* THIS AGREEMENT IN ANY OF THE AFOREMENTIONED FILES, OR IF YOU DO */
/* NOT HAVE THESE FILES, YOU SHOULD IMMEDIATELY CONTACT BIT BUCKET */
/* SOFTWARE CO. AT ONE OF THE ADDRESSES LISTED BELOW. IN NO EVENT */
/* SHOULD YOU PROCEED TO USE THIS FILE WITHOUT HAVING ACCEPTED THE */
/* TERMS OF THE BINKLEYTERM LICENSING AGREEMENT, OR SUCH OTHER */
/* AGREEMENT AS YOU ARE ABLE TO REACH WITH BIT BUCKET SOFTWARE, CO. */
/* */
/* */
/* You can contact Bit Bucket Software Co. at any one of the following */
/* addresses: */
/* */
/* Bit Bucket Software Co. FidoNet 1:104/501, 1:343/491 */
/* P.O. Box 460398 AlterNet 7:491/0 */
/* Aurora, CO 80046 BBS-Net 86:2030/1 */
/* Internet f491.n343.z1.fidonet.org */
/* */
/* Please feel free to contact us at any time to share your comments about */
/* our software and/or licensing policies. */
/* */
/* */
/*--------------------------------------------------------------------------*/
/* Include this file before any other includes or defines! */
#include "includes.h"
int Send_Hello_Packet (int);
int Recv_Hello_Packet (int);
/*--------------------------------------------------------------------------*/
/* YOOHOO SENDER (used when I am the CALLING system) */
/*--------------------------------------------------------------------------*/
int YooHoo_Sender (void)
{
char *sptr;
if (un_attended && fullscreen)
{
sb_move (file_hWnd, 2, 2);
FlLnModeSet( FILE_LN_2, 0 );
sb_puts( GetDlgItem( file_hWnd, FILE_LN_2 ), "YooHoo" );
sb_show ();
}
else
{
set_xy ("YooHoo ");
}
/*--------------------------------------------------------------------*/
/* Clean up any mess that may be around */
/*--------------------------------------------------------------------*/
CLEAR_OUTBOUND ();
CLEAR_INBOUND ();
XON_DISABLE ();
if (!Send_Hello_Packet (1))
sptr = MSG_TXT(M_HE_HUNG_UP);
else
{
if (TIMED_READ (30) == YOOHOO)
return Recv_Hello_Packet (1);
status_line ("!No YOOHOO/2U2");
sptr = IDUNNO_msg;
}
status_line (sptr);
return (0);
}
/*--------------------------------------------------------------------------*/
/* YOOHOO RECEIVER (Used when I am the CALLED system) */
/*--------------------------------------------------------------------------*/
int YooHoo_Receiver (void)
{
int i;
int c;
if (un_attended && fullscreen)
{
sb_move (file_hWnd, 2, 2);
FlLnModeSet( FILE_LN_2, 0 );
sb_puts( GetDlgItem( file_hWnd, FILE_LN_2 ), "YooHoo" );
sb_show ();
}
else
{
set_xy ("YooHoo ");
}
/*--------------------------------------------------------------------*/
/* Clean up any mess that may be around */
/*--------------------------------------------------------------------*/
CLEAR_OUTBOUND ();
CLEAR_INBOUND ();
XON_DISABLE ();
if (Recv_Hello_Packet(0) == 0)
return (0);
for (i = 0; (CARRIER) && (i < 10); i++)
{
if ((c = TIMED_READ (10)) == ENQ)
{
if ((i = Send_Hello_Packet (0)) == 0)
b_init ();
return (i);
}
if (c > 0)
{
(void) printf ("[%x] ", c);
/* Delay one second, then try again */
big_pause (1);
CLEAR_INBOUND ();
}
SENDBYTE (YOOHOO);
}
status_line (MSG_TXT(M_FUBAR_MSG));
b_init ();
return (0);
} /* YooHoo Receiver */
/*--------------------------------------------------------------------------*/
/* SEND HELLO PACKET */
/*--------------------------------------------------------------------------*/
int Send_Hello_Packet (int Sender)
{
int i;
struct _Hello Hello;
char *sptr;
long response_timer;
word crc;
word num_errs = 0;
word can_do_domain = 0;
char junkbuff[128];
/*--------------------------------------------------------------------*/
/* Setup HELLO structure */
/*--------------------------------------------------------------------*/
(void) memset ((char *) &Hello, 0, sizeof (struct _Hello));
Hello.signal = 'o';
Hello.hello_version = 1;
Hello.product = PRDCT_CODE;
Hello.product_maj = BINK_MAJVERSION;
Hello.product_min = BINK_MINVERSION;
(void) strncpy (Hello.sysop, sysop, 19);
Hello.sysop[19] = '\0';
Hello.my_zone = alias[assumed].Zone;
if ((pvtnet >= 0) && (Sender) &&
((called_addr.Zone == boss_addr.Zone) || (called_addr.Zone == 0) || (boss_addr.Zone == 0)) &&
(called_addr.Net == boss_addr.Net) && (called_addr.Node == boss_addr.Node) &&
((called_addr.Domain == boss_addr.Domain) || (boss_addr.Domain == NULL) || (called_addr.Domain == NULL)))
{
Hello.my_net = boss_addr.Net;
Hello.my_node = boss_addr.Node;
Hello.my_point = alias[assumed].Node;
}
else
{
Hello.my_net = alias[assumed].Net;
Hello.my_node = alias[assumed].Node;
Hello.my_point = alias[assumed].Point;
}
/*
* If we are the calling system, turn on all our capabilities.
* If we are the called system, choose from the set that the
* c